-#  This file is app/views/movies/index.html.haml
%h1 All Movies

= form_tag movies_path, :method => :get, :id => 'ratings_form' do
  = hidden_field_tag "title_sort", true if @title_header
  = hidden_field_tag ":release_date_sort", true if @date_header
  Include: 
  - @all_ratings.each do |rating|
    = rating
    = check_box_tag "ratings[#{rating}]", 1, @selected_ratings.include?(rating), :id => "ratings_#{rating}"
  = submit_tag 'Refresh', :id => 'ratings_submit'

%table#movies
  %thead
    %tr
      %th{:class => @title_header}= link_to 'Movie Title', movies_path(:sort => 'title', :ratings => @selected_ratings), :id => 'title_header'
      %th Rating
      %th{:class => @date_header}= link_to 'Release Date', movies_path(:sort => 'release_date', :ratings => @selected_ratings), :id => 'release_date_header'
      %th More Info
  %tbody
    - @movies.each do |movie|
      %tr
        %td= movie.title 
        %td= movie.rating
        %td= movie.release_date
        %td= link_to "More about #{movie.title}", movie_path(movie)

= link_to 'Add new movie', new_movie_path
